伪静态的实现浅析

如下程序实现从
/hello/bowmanhan/

/hello.php?user=ddddddd
的url映射,即php里常讲的伪静态

一个php程序的目录结构

D:htdocs/
├─phpapp1├─ hello.php
├        ├─ .htaccess

hello.php文件

#filename:hello.php 
hello<?php echo $_GET[‘name’]; ?>

.htaccess文件

#filename:.htaccess
RewriteEngine on
RewriteRule ^www.example.com/hello/([^.]+) http://www.example.com/hello.php?user=$1

flask

view.py
@url('/hello/<user>')
def hello(user):
    return 'hello'+user

数据库定义如下

table user (
name varchar() primary ,
password varchar()
);

url资源定位符

/user/<name>/

什么是CRUD
CRUD 是 Create Read Update Delete 的缩写,即我们中文所说的数据库的增删查改
CRUD分别对应http协议的四种方法,

C <--> post
R <--> get
U <--> put
D <--> delete

Bowman_han
91 声望3 粉丝